<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
    <%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
    <%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
<meta name="renderer" content="webkit">
<title></title>
<link rel="stylesheet" href="css/pintuer.css">
<link rel="stylesheet" href="css/admin.css">
<script src="js/jquery.js"></script>
<script src="js/pintuer.js"></script>
<script type="text/javascript">
function delUser(id){
	if(confirm("确定要删除么？")){
	$.ajax({
		type:"GET",
		url:"/HNUST/user/delUser",
		data:{id:id},
		dataType:'JSON',
		success:function(data){
		alert(data.result);
		location.reload();
},error:function(data){
	alert("error:"+data)
}
});
	}
}
</script>
</head>
<body>
<div class="panel admin-panel">
  <div class="panel-head"><strong class="icon-reorder"> 内容列表</strong></div>
  <div class="padding border-bottom">  
     <div class="padding border-bottom">
     <form action="usermh" method="post">
      <ul class="search" style="padding-left:10px;">
        <li> <a class="button border-main icon-plus-square-o" href="useradd"> 添加内容</a> </li>
       
        <li>
          <input type="text" placeholder="请输入搜索关键字" name="userName" class="input" style="width:250px; line-height:17px;display:inline-block" />
          <button class="button bg-main icon-check-square-o" type="submit">
							搜素</button>
          </li>
      </ul>
      </form>
    </div>
  </div>
  <table class="table table-hover text-center">
    <tr>
      <th width="10%">编号</th>
      <th width="20%">用户名</th>
      <th width="15%">密码</th>
      <th width="20%">创建时间</th>
      <th width="10%">排序</th>
      <th width="15%">操作</th>
    </tr>
   <c:forEach items="${users }" var="user" varStatus="status">
    <tr>
      <td>${status.index+1 }</td>     
      <td>${user.userName }</td>     
      <td>${user.password }</td>
      <td>${user.createtime }</td>
      <td></td>
      <td><div class="button-group">
      <a class="button border-main" href="Userupdate?userName=${user.userName }"><span class="icon-edit"></span> 修改</a>
      
      <button class="button bg-main icon-trash-o" onclick="delUser(${user.user_id });">删除</button>
      </div></td>
      
    </tr>
    </c:forEach>
       <tr>
            <td colspan="8"><div class="pagelist"> 
            <!-- 分页功能 start -->
            <div align="center">
                <font size="2">共 ${page.totalPageCount} 页</font> <font size="2">第
                ${page.pageNow} 页</font> <a href="queryAll?pageNow=1">首页</a>
                <c:choose>
                    <c:when test="${page.pageNow - 1 > 0}">
                        <a href="queryAll?pageNow=${page.pageNow - 1}">上一页</a>
                    </c:when>
                    <c:when test="${page.pageNow - 1 <= 0}">
                        <a href="queryAll?pageNow=1">上一页</a>
                    </c:when>
                </c:choose>
                <c:choose>
                    <c:when test="${page.totalPageCount==0}">
                        <a href="queryAll?pageNow=${page.pageNow}">下一页</a>
                    </c:when>
                    <c:when test="${page.pageNow + 1 < page.totalPageCount}">
                        <a href="queryAll?pageNow=${page.pageNow + 1}">下一页</a>
                    </c:when>
                    <c:when test="${page.pageNow + 1 >= page.totalPageCount}">
                        <a href="queryAll?pageNow=${page.totalPageCount}">下一页</a>
                    </c:when>
                </c:choose>
                <c:choose>
                    <c:when test="${page.totalPageCount==0}">
                        <a href="queryAll?pageNow=${page.pageNow}">尾页</a>
                    </c:when>
                    <c:otherwise>
                        <a href="queryAll?pageNow=${page.totalPageCount}">尾页</a>
                    </c:otherwise>
                </c:choose>
            </div>
            <!-- 分页功能 End -->
            </div></td>
        </tr>
  </table>
</div>

</body></html>